﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Summary description for SavingDetailsDAL
/// </summary>
public class SavingDetailsDAL
{
	public SavingDetailsDAL()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public DataSet getSelfDetail(String custID)
    {

        SqlConnection con = DBManager.getSqlConnection();

        String sql = "SELECT C.email, C.fName, C.lName, C.custNRIC, C.custGender, convert(nvarchar(20),C.custDob,103) custDob, C.custTel, C.custMobile, C.custAddress, C.custNationality," +
                     "C.custOccupation, C.custPostal, C.custMarital, S.savingType" +
                     " FROM  CUSTOMER AS C  INNER JOIN" +
                     " SAVING_ACCOUNT AS S ON C.custID = S.custID" +
                     " WHERE S.custID=@custID ";

        SqlCommand cmd = new SqlCommand(sql, con);
        cmd.Parameters.AddWithValue("@custID", custID);

        SqlDataAdapter myAdapter = new SqlDataAdapter(cmd);

        DataSet myDs = new DataSet();

        myAdapter.Fill(myDs, "SelfDetail");

        return myDs;
    }

   
}